package pri.syl.xiaowu.websocket.init.core.factory.execution;

import pri.syl.xiaowu.websocket.netty.core.factory.constant.ThreadPoolFactoryConstant;
import pri.syl.xiaowu.websocket.netty.core.factory.execution.ThreadPoolFactoryExecution;
import pri.syl.xiaowu.websocket.netty.server.thread.execution.WebsocketServerInitThreadExecution;

import java.util.concurrent.ThreadPoolExecutor;

/**
 * @Author YunLong
 * @Date 2021/7/18 18:41
 * @Description 初始化执行工厂
 **/
public class WebsocketInitExecution {
    private WebsocketInitExecution() {
    }

    /*
     * 使用初始化线程执行初始化
     * @apiNote [附加描述]
     * @param url
     * @param websocketMaxFramePayloadLength
     * @param websocketReadTimeoutMilli
     * @return void
     * @author YunLong
     * @date 2021/7/19 9:13
     */
    public static void init(String url, int websocketMaxFramePayloadLength, int websocketReadTimeoutMilli) {
        WebsocketServerInitThreadExecution initThreadExecution = new WebsocketServerInitThreadExecution(url, websocketMaxFramePayloadLength, websocketReadTimeoutMilli);
        ThreadPoolExecutor initThreadPool = ThreadPoolFactoryConstant.WEBSOCKET_SERVER_INIT_THREAD_POOL;
        ThreadPoolFactoryExecution.statsThreadAndShutdown(initThreadPool, initThreadExecution);
    }
}
